<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="author" content="纪德朝">
    <title>鼠标进去遮罩层</title>
    <style>
        body {
            background-color: gray;
        }

        div {
            text-align: center;
            background-color: gray;
            padding: 0;
            width: 400px;
            margin: 50px auto;
        }

        ul,
        li {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        ul {
            display: flex;

            justify-content: center;
        }

        ul li:nth-child(3) {
            margin-left: 15px;
        }

        div>li {
            background-color: white;
        }

        li {
            margin-bottom: 10px;
            border: 5px solid white;
            position: relative;
            transition: all 1s linear;
            /*溢出隐藏  */
            overflow: hidden;
        }

        li:hover {
            border-color: orange;
        }

        .active {
            width: 170px;
            height: 170px;
            position: absolute;
            left: -175px;
            top: 0;
            opacity: 0;
            z-index: -1;
        }

        li>p {
            display: inline-block;
            margin: 0;
            padding: 0;
            width: 370px;
            height: 60px;
            margin-top: 25px;
            background-color: white;
            color: black;
        }

        .active p {
            margin: 0;
            padding: 0;
            width: 170px;
            height: 170px;
        }

        .none {
            display: none;
        }

        section {
            width: 400px;
            margin: 10px auto;
            background-color: white;
        }

        ul>li {
            position: relative;
        }

        .current {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background-color: rgba(0, 0, 0, 0.5);
            opacity: 0;
            transition: all 0.3s linear;
        }

        li:hover .current {
            opacity: 0.5;
        }
    </style>
</head>

<body>
    <div>
        <li>
            <img src="img/1.jpg" alt="">
            <p>你说的数据库动画时间电视电话设定是框架打算立刻觉得开始倒计时肯德基圣诞节看似简单可莱丝觉得两款手机</p>
        </li>
    </div>
    <section>
        <ul>
            <li>
                <img src="img/2.jpg" alt="">
                <ul class="active">
                    <p>【金溪】，设计上上课第四季度事件的手机打开手机深刻理解的开始了觉得</p>
                </ul>
                <main class="current"></main>
            </li>
            <li>
                <img src="img/3.jpg" alt="">
                <ul class="active">
                    <p>【金溪】，设计上撒大声地设定收到货收到几点上课的健康就是当时看到记录</p>
                </ul>
                <main class="current"></main>
            </li>
        </ul>
    </section>
    <script src="./js/jquery.js"></script>
</body>
<script>
    $('section>ul>li').mouseenter(function () {
        $('.active').eq($(this).index()).css('z-index', 1).animate({
            left: 0,
            opacity: 0.8,
        }, 500);

    });
    $('section>ul>li').mouseleave(function () {
        $('.active').eq($(this).index()).animate({
            left: -170,
            opacity: 0,
            zIndex: -1,
        }, 500);
    });

</script>

</html>